﻿using SG;
using System;
using UnityEngine;

public class TimeHelper
{

    private static readonly long epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks;
    /// <summary>
    /// 客户端时间
    /// </summary>
    /// <returns></returns>
    public static long ClientNow()
    {
        return (DateTime.UtcNow.Ticks - epoch) / 10000;
    }

    static TimeHelper m_Instance;

    public static TimeHelper Instance()
    {
        if (m_Instance == null)
            m_Instance = new TimeHelper();
        return m_Instance;
    }

    float m_start;

    public void TimerStart()
    {
        m_start = Time.realtimeSinceStartup;
    }
    public void TimerEnd(string strLog)
    {
        LogMgr.Instance().LogError(strLog + " 耗时{0}  ", (Time.realtimeSinceStartup - m_start));
        m_start = Time.realtimeSinceStartup;
    }

}
